 package dk.aau.walkietalkieui.message;

import java.io.File;
import java.sql.Date;
import java.text.SimpleDateFormat;

import dk.aau.walkietalkie.database.Identification;

public class MyMessage {

	private String str_aux =null;
	//private File data; // generic file

	public static enum MessageType {TYPE_RECORD, TYPE_PICTURE, TYPE_TEXT};
	private String data_path;

	private Identification name;
	private String time;
	private MessageType type;
	private Identification destiny;
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat(
			"MM/dd HH:mm:ss");
	
	public MyMessage( /*File data*/ Identification name, long time, MessageType type,Identification destiny,String dataPath) {
		//this.data = data;
		this.name = name;
		this.destiny = destiny;
		this.time = dateFormat.format(new Date(time));;
		this.type = type;
		this.data_path = dataPath;
	
	}
	/*
	public File getData(){
		return this.data;
	}
	*/
	public String getTCPMessage(String data_letter) {
			str_aux = ("IdentificationSender: " + name.getIp() + "/#/" + name.getName() +"||" +
						"IdentificationDestiny: " + destiny.getIp() + "//#//" + destiny.getName() +"|||" +
						"Type: " + type +"||||"+
						"Data: " + data_letter + " END###!!!");
			
		return str_aux;
	}
	
	public String getNameOwn() {
		return this.name.getName();
	}
	
	public String getIPOwn() {
		return this.name.getIp();
	}

	public String getTime() {
		return this.time;
	}
	
	public MessageType getType() {
		return this.type;
	}
	
	public String getDataPath(){
		return this.data_path;
	}
	
	public String getDestinyName() {
		return this.destiny.getName();
	}
	public String getDestinyIp() {
		return this.destiny.getIp();
	}
	
}
